<template>
  <view class="u-page__item">
    <u-cell-group>
      <u-cell
        class="my_text"
        v-for="item in list"
        :key="item.id"
        :title="item.title"
        value="内容"
        :label="item.read + '浏览'"
        @click="goDetail(item.id)"
        center
      >
        <view slot="value">
          <image class="img" :src="item.thumb_img"></image>
        </view>
      </u-cell>
    </u-cell-group>
    <view v-if="flag" class="isOver">
			----我是有底线的----
		</view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      recommend: 1,
      total: 0,
      flag: false
    }
  },
  mounted() {
    this.getList()
  },
  onReachBottom() {
    if(this.recommend >= this.total) {
      this.flag = true
      return
    }
    this.recommend = ++this.recommend
    this.getList()
  },
  methods: {
    async getList() {
      const {data} = await this.$axios({
        url: '/api/index/article',
        data: {
          recommend: this.recommend
        }
      })
      this.list = this.list.concat(data.list.data)
      this.total = data.list.total
    },
    goDetail(id) {
      uni.navigateTo({
        url: `/pages/examination/detail/information-detail?id=${id}`
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.u-page__item{
  margin: 0 20rpx;
  background: #FFFFFF;
}
.my_text{
  height: 210rpx;
}
.img{
  width: 220rpx;
  height: 140rpx;
}
.isOver{
  text-align: center;
  line-height: 100rpx;
}
</style>
